package service

import (
	"context"
	"errors"
	greeterPb "{{.ProjectName}}/pb"
	"fmt"

	"gitee.com/wu-jin-feng/fgin"
)

type GreeterService struct {
	F *fgin.Fgin
	greeterPb.UnimplementedGreeterServiceServer
}

func NewGreeterService(f *fgin.Fgin) *GreeterService {
	return &GreeterService{F: f}
}

func (s *GreeterService) GetScheme(ctx context.Context, req *greeterPb.GetSchemeReq) (*greeterPb.GetSchemeResp, error) {
	if req.Info == nil {
		return nil, errors.New("info 不能为空")
	}
	endData := &greeterPb.GetSchemeResp{
		Data: req.Path + ",gogogo",
		Info: &greeterPb.GetSchemeRespInfo{
			Info: fmt.Sprintf("这是一个info,%s", req.Info.Info),
			Name: fmt.Sprintf("作者是%s", req.Info.Name),
		},
	}
	return endData, nil
}
